package com.mvu.banana.guest.server;

import com.mvu.banana.common.client.ServiceToken;
import com.mvu.banana.common.server.SessionManager;
import com.mvu.banana.guest.client.gen.LoginPanelDTO;
import com.mvu.banana.guest.server.gen.LoginPanelServletStub;

public class LoginPanelServlet extends LoginPanelServletStub{
  
  public LoginPanelDTO post(LoginPanelDTO p0){
    request.setAttribute(EMAIL_ATTR, p0.emailInput);
    request.setAttribute(PASSWORD_ATTR, p0.passwordInput);
    ServiceToken serviceToken = SessionManager.get().login(request);
    p0.username = serviceToken.getUsername();
    p0.errorMessage = (String) request.getAttribute(SYSTEM_MESSAGE);
    return p0;
  }
}